home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / tool+ / vbls < prev   
Text File  |  1993-04-24  |  1KB  |  66 lines

  1. \ 4.6.87    rfl    vbl queue manipulation
  2. \ 1.1.88    rfl    general cleanup
  3. \ 4.22.93    rfl    changed proc method
  4.  
  5. hex
  6.  
  7. create vinstall
  8.     205f w,            \ move.l    (a7)+,a0
  9.     a033 w,            \ call vinstall
  10.     48c0 w,            \ ext.l    d0
  11.     2f00 w,            \ move.l    d0,-(a7)
  12. next,
  13.  
  14. create vremove
  15.     205f w,            \ move.l (a7)+,a0
  16.     a034 w,            \ call vremove
  17.     48c0 w,            \ ext.l    d0
  18.     2f00 w,            \ move.l    d0,-(a7)
  19. next,
  20. decimal
  21.  
  22. :CLASS vblTask <super object
  23.  
  24.     var            qlink
  25.     int            qtype
  26.     var            procPtr
  27.     int            vblCount
  28.     int            vblPhase
  29.  
  30.     var            myProc
  31.  
  32.   :M init: ( 'cProc --) >body put: myProc ;M
  33.  
  34. ( 1/60ths of second -- )
  35.   :M SetDelay: put: vblCount ;M
  36.  
  37. (  -- errcode)
  38.   :M install: get: myProc body> initProc get: myProc +base put: procPtr
  39.      abs: self vinstall abort" install error" ;M
  40.  
  41. ( -- errcode)
  42.   :M remove: abs: self vremove . ;M
  43.  
  44.   :M classinit: 1 put: qtype ;M
  45.  
  46. ;class
  47.  
  48. vblTask myTask
  49.  
  50. \ Now to use this, create a :Vproc definition which is the background task
  51. \ you want to perform. You can set the delay (in 1/60ths
  52. \ of a second) for periodic execution using the setDelay: method.  The
  53. \ task itself must reset this delay everytime it executes.  The task
  54. \ should ultimately be written in assembly, since all other events
  55. \ are on hold while your word is being executed.
  56.  
  57. \ example below
  58. 0 value aCounter
  59. :Proc counter -curs pushport set: fwind
  60.     home aCounter . 1 ++> aCounter 60 setdelay: myTask popPort ;proc
  61. 'c counter init: myTask
  62. 120 setdelay: myTask
  63. \ 'c counter install: myTask
  64. \ to remove, say remove: myTask
  65.  
  66.